package cn.com.infohold.smartcity.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import cn.com.infohold.smartcity.R;
import cn.com.infohold.smartcity.api.bean.AppendageBean;

/**
 * Created by Monsoon on 2017/11/17.
 */
public class WarrantAdd_AppendAdapter extends RecyclerView.Adapter<WarrantAdd_AppendAdapter.mViewHolder>{

    List<AppendageBean> mList;

    public WarrantAdd_AppendAdapter(List<AppendageBean> mList) {
        this.mList = mList;
    }

    @Override
    public mViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        mViewHolder viewHolder = new mViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_warrantadd_append, parent, false));
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(mViewHolder holder, int position) {
        AppendageBean bean = mList.get(position);
        holder.tv_name.setText(bean.getName());
        holder.tv_address.setText(bean.getAddress());
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    class mViewHolder extends RecyclerView.ViewHolder{

        TextView tv_name;
        TextView tv_address;

        public mViewHolder(View itemView) {
            super(itemView);
            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
            tv_address = (TextView) itemView.findViewById(R.id.tv_address);
        }
    }
}
